home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / MISC.SWG / 0113_Determine is program is being debugged!.pas < prev    next >
Pascal/Delphi Source File  |  1995-03-03  |  731b  |  31 lines

  1. {
  2. >> Does any body have source code to tell me if my program
  3. >> is being debugged with TURBO DEBUGGER. ?
  4.  
  5. It is possible to detect if your program is debugged. Debuggers use interrupt 3
  6. for breakpoints. The following example will simply crash the program if its run
  7. with Turbo Debugger, under DOS there's no problem.
  8.  
  9. CAUTION : this program wil crash if run under a debugger, including the
  10.           IDE (when you make use of breakpoints)
  11. }
  12.  
  13. Program DebugTest ;
  14. Uses
  15.   DOS ;
  16. var
  17.   OldInt3 : Pointer ;
  18. {$F+}
  19.  
  20. Procedure Int3 ; assembler ;
  21. ASM
  22. end ;
  23.  
  24. Begin
  25.   GetIntVec (3, OldInt3) ;
  26.   SetIntVec (3, @int3) ;
  27.   { Put breakpoint here }
  28.   Writeln ('Breakpoint action ?') ;
  29.   SetIntVec (3, OldInt3) ;
  30. end.
  31.